import request from '@/utils/request'

// 查询建设项目列表
export function listProject(query) {
  return request({
    url: '/project/project/list',
    method: 'get',
    params: query
  })
}

// 建设项目下拉框
export function selectProjectList() {
  return request({
    url: '/project/project/selectProjectList',
    method: 'get'
  })
}

// 查询建设项目详细
export function getProject(projectId) {
  return request({
    url: '/project/project/' + projectId,
    method: 'get'
  })
}

/**
 * 根据项目编号获取项目信息
 *
 * @param data 项目编号
 * @returns 项目信息
 */
export function getProjectByCode(data) {
  return request({
    url: '/project/project/getProjectByCode',
    method: 'post',
    params: data
  })
}

// 新增建设项目
export function addProject(data) {
  return request({
    url: '/project/project',
    method: 'post',
    data: data
  })
}

// 修改建设项目
export function updateProject(data) {
  return request({
    url: '/project/project',
    method: 'put',
    data: data
  })
}

// 删除建设项目
export function delProject(projectId) {
  return request({
    url: '/project/project/' + projectId,
    method: 'delete'
  })
}

// 导出建设项目
export function exportProject(query) {
  return request({
    url: '/project/project/export',
    method: 'get',
    params: query
  })
}

// 获取项目百章金额饼状图数据
export function getProjectHundredChaptersTotalChartPie(projectId) {
  return request({
    url: '/project/project/getProjectHundredChaptersTotalChartPie/' + projectId,
    method: 'get'
  })
}
